﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace LegSec.NugetThirdPartyLicenseFileGenerator
{
    public class NupkgSelector
    {
        public const string nupkgFilter = "*.nupkg";
        public NupkgSelector()
        {
        }

        public List<FileInfo> findNupkgFromDirectory(DirectoryInfo rootDirectory)
        {
            List<FileInfo> nupkgFiles = new List<FileInfo>();
            nupkgFiles.AddRange(rootDirectory.GetFiles(nupkgFilter));
            foreach (var directoryInfo in rootDirectory.GetDirectories())
            {
                nupkgFiles.AddRange(findNupkgFromDirectory(directoryInfo));
            }
            return nupkgFiles;
        }
    }
}
